<?php
	require_once("pre.php");
	require_once("auth.php");
?>
<?php if(! est_autorise("acces_codespromos")) exit; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php require_once("title.php");?>

<?php
	require_once("../classes/Rubrique.class.php");
	require_once("../fonctions/divers.php");
	require_once("../classes/Promo.class.php");

	if(!isset($id)) $id="";
	if(!isset($types)) $types="";
	if(!isset($utiliseo)) $utiliseo="";
	if(!isset($illimiteo)) $illimiteo="";

	$utilisen = "";
	$illimiten = "";
	$typep = "";

?>


<?php
	$promo = new Promo();
	$promo->charger_id($id);

	if(! $promo->utilise) $utiliseo = "checked=\"checked\"";
	else $utilisen = "checked=\"checked\"";

	if($promo->illimite) $illimiteo = "checked=\"checked\"";
	else $illimiten = "checked=\"checked\"";

	if($promo->type == "1") $types = "checked=\"checked\"";
	else $typep = "checked=\"checked\"";

	$jour = substr($promo->datefin, 8, 2);
	$mois = substr($promo->datefin, 5, 2);
	$annee = substr($promo->datefin, 0, 4);

?>
</head>

<body>
<div id="wrapper">
<div id="subwrapper">

<?php
	$menu="paiement";
	require_once("entete.php");
?>

<div id="contenu_int">
<p><a href="accueil.php" class="lien04"><?php echo trad('Accueil'); ?> </a>  <img src="gfx/suivant.gif" width="12" height="9" border="0" /> <a href="promo.php" class="lien04"><?php echo trad('Gestion_codes_promos'); ?></a> <img src="gfx/suivant.gif" width="12" height="9" border="0" /><a href="#" class="lien04"><?php if($id) { ?><?php echo trad('Modifier'); ?> <?php } else { ?> <?php echo trad('Ajouter'); ?> <?php } ?></a>
    </p>

<!-- Début de la colonne de gauche -->
<div id="bloc_description">
<form action="promo.php" id="formulaire" method="post">
<div class="bordure_bottom">
<div class="entete">
			<div class="titre"><?php echo trad('MODIFICATION_CODE_PROMO'); ?></div>
			<div class="fonction_valider"><a href="#" onclick="document.getElementById('formulaire').submit()"><?php echo trad('VALIDER_LES_MODIFICATIONS'); ?></a></div>
</div>
<input type="hidden" name="action" value="<?php if($id != "") { ?>modifier<?php } else { ?>ajouter<?php } ?>" />
<input type="hidden" name="id" value="<?php echo($id); ?>" />
  	<ul class="ligne_claire_BlocDescription" style="background-image: url(gfx/degrade_ligne1.png); background-repeat: repeat-x;">
		<li class="designation" style="width:280px; background-image: url(gfx/degrade_ligne1.png); background-repeat: repeat-x;"><?php echo trad('Code'); ?></li>
		<li><input name="code" type="text" class="form" value="<?php echo  htmlspecialchars($promo->code); ?>" size="40" /></li>
	</ul>
	<ul class="ligne_fonce_BlocDescription">
		<li class="designation" style="width:280px;"><?php echo trad('Type'); ?></li>
		<li><input name="type" type="radio" class="form" value="1" <?php echo($types); ?> />
<?php echo trad('somme'); ?>
<input name="type" type="radio" class="form" value="2" <?php echo($typep); ?> />
<?php echo trad('pourcentage'); ?></li>
	</ul>
	<ul class="ligne_claire_BlocDescription">
		<li class="designation" style="width:280px;"><?php echo trad('Montant_code_promo'); ?></li>
		<li><input name="valeur" type="text" class="form" value="<?php echo($promo->valeur); ?>" size="10" /></li>
	</ul>
	<ul class="ligne_fonce_BlocDescription">
		<li class="designation" style="width:280px;"><?php echo trad('Montant_achat_mini'); ?></li>
		<li><input name="mini" type="text" class="form" value="<?php echo($promo->mini); ?>" size="10" /></li>
	</ul>
	<ul class="ligne_claire_BlocDescription">
		<li class="designation" style="width:280px;"><?php echo trad('Code_actif'); ?></li>
		<li><?php echo trad('Oui'); ?> <input name="utilise" type="radio" class="form" value="0" <?php echo($utiliseo); ?> /> &nbsp; <?php echo trad('Non'); ?> <input name="utilise" type="radio" class="form" value="1" <?php echo($utilisen); ?> /></li>
	</ul>
	<ul class="ligne_fonce_BlocDescription">
		<li class="designation" style="width:280px;"><?php echo trad('Utilisation_unique_illimite'); ?></li>
		<li><?php echo trad('Unique'); ?><input name="illimite" type="radio" class="form" value="0"  <?php echo($illimiten); ?>/> &nbsp; <?php echo trad('Illimite'); ?> <input name="illimite" type="radio" class="form" value="1"  <?php echo($illimiteo); ?>/></li>
	</ul>
	<ul class="ligne_claire_BlocDescription">
		<li class="designation" style="width:280px;"><?php echo trad('Date_expi'); ?></li>
		<li><input name="jour" type="text" class="form" value="<?php echo($jour); ?>" size="2" />
       <input name="mois" type="text" class="form" value="<?php echo($mois); ?>" size="2" />
	   <input name="annee" type="text" class="form" value="<?php echo($annee); ?>" size="4" /></li>
	</ul>
</div>

<div class="patchplugin">
<?php
	ActionsAdminModules::instance()->inclure_module_admin("promomodifier");
?>
</div>

</form>


</div>
<!-- fin du bloc description -->

   </div>
   <?php require_once("pied.php");?>
   </div>
   </div>
</body>
</html>
